package kafkastudy.spring;

import org.apache.kafka.clients.producer.RecordMetadata;
import org.springframework.kafka.support.ProducerListener;

/**
 * Created by hp on 2017/9/30.
 */
public class KafkaProducerListener implements ProducerListener<String,String> {
    public void onSuccess(String s, Integer integer, String o, String o2, RecordMetadata recordMetadata) {

        System.out.println("topic:" + s + "partition:" + integer + "key:" + o + "value:" + o2 + "RecordMetadata:" + recordMetadata);
        System.out.println("成功业务逻辑");
    }

    public void onError(String s, Integer integer, String o, String o2, Exception e) {

        System.out.println("topic:" + s + "partition:" + integer + "key:" + o + "value:" + o2 + "exception:" + e);
        System.out.println("失败业务逻辑");
    }

    public boolean isInterestedInSuccess() {
        return true;
    }
}
